home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: strings from VB
- Date: 14 Jan 1996 21:54:49 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4dbu39$cj4@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe2.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 14, 1996 19:33:06 in article <strings from VB>, 'mgooding@wolfe.net
- (Joshua Gooding)' wrote:
-
-
- >I am writing a DLL in Borland C++ that has several functions that I am
- >going to call from a Visual Basic 3.0 Professional application but I need
- >to pass a string to the function. How would I go about doing this. Does
-
- >Visual Basic pass strings as pointers to characters?
-
- This is really a VB question, but what the heck, C++ people might
- want to know also.
-
- Given a DLL function declared as:
-
- extern "C" int WINAPI Foo (LPSTR s, int n);
-
- In VB module, write
-
- Declare Function Foo Lib "FOO.DLL" (Byval x as string,
- byval y as integer) as integer
-
- In your code write:
- dim xx as string * 25
- dim len as integer
-
- len = Foo(xx, 25);
-
- Now, the DLL function can write to the string xx up to
- 25 characters. (24 if null terminated).
-
- Send e-mail if you want a sample.
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-